<template>
  <div class="showControl">
    <div class="control-head" v-if="showControlHeader">
      <p class="section-name">{{ title }}</p>
      <p class="reset" @click="reset">重置</p>
    </div>
    <div class="color-control">
      <span>{{ hideControl ? "开启" : "关闭" }}</span>
      <a-switch @change="switchChange" :checked="hideControl" />
    </div>
  </div>
</template>

<script>
export default {
  name: "",
  components: {},
  props: {
    isHide: {
      type: Boolean,
      default: false,
    },
    title: {
      type: String,
      default: "模块显示隐藏",
    },
    showControlHeader: {
      type: Boolean,
      default: true,
    },
  },
  data() {
    return {};
  },
  watch: {},
  mounted() {},
  computed: {
    hideControl: {
      get() {
        return this.isHide;
      },
      set(val) {
        this.hideControl = val;
      },
    },
  },
  methods: {
    // 点击重置
    reset() {
      this.$emit("reset");
    },
    // 修改
    switchChange(e) {
      this.$emit("hideChange", e);
    },
  },
};
</script>

<style lang="scss" scoped>
.showControl {
  .control-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0 12px 0;
    font-size: 12px;
    font-weight: 400;
    color: #000000;
    .reset {
      font-size: 12px;
      font-weight: 400;
      color: #8e8e8e;
      cursor: pointer;
      user-select: none;
    }
    p {
      margin: 0;
    }
  }
}
.color-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 40px;
  background-color: #f6f7f9;
  border-radius: 4px;
  padding: 0 14px;
  input {
    border: 0 none;
    height: 100%;
    background: #f6f7f9;
    padding-top: 0;
    padding-bottom: 0;
    outline: none;
  }
  .ant-input {
    width: 48px;
    height: 40px;
    padding: 6px 12px;
  }
  span {
    font-size: 14px;
    color: #000;
  }
}
.color-control:hover {
  background: #f2f2f2;
}
</style>
